<template>
  <div>
    <form action="">
      姓名：<input type="text" v-model="uname" /><br />
      年龄：<input type="number" v-model="age" /><br />
      身高：<input type="text" v-model.number="height" /><br />
      体重：<input type="number" v-model.number="weight"  /><br />
      病史：<input type="text" v-model="bing" /><br />
      <button @click.prevent="zhenduan">诊断</button>
    </form>
    <h3>{{result}}</h3>
  </div>
</template>

<script>
export default {
data(){
  return{
    uname:'',
    age:0,
    height:0,
    weight:0,
    bing:'',
    result:''
  }
},
methods:{
  zhenduan(){
   let bmi= this.weight / (this.height *this.height /100 /100)
   if(bmi<18.5){
    this.result = `${this.uname},你的诊断结果是：体重过轻`
   }else if(bmi >18.5 && bmi <=24.9){
      this.result = `${this.uname},你的诊断结果是：正常`
   }else if(bmi >24.9 && bmi<=29.9){
    this.result = `${this.uname},你的诊断结果是：体重过重`
   }else{
    this.result = `${this.uname},你的诊断结果是：肥胖`
   }
  }
}
}
</script>

<style>

</style>